package com.ehotting.edsta.mqbd.signal.netty.action;


import com.ehotting.eaf.netty.action.Action;
import com.ehotting.eaf.netty.action.ActionAble;
import com.ehotting.eaf.netty.domain.DataAble;
import com.ehotting.edsta.mqbd.signal.api.SignalActionConstants;
import com.ehotting.edsta.mqbd.signal.api.domain.netty.CallSimulateRequest;
import com.ehotting.mqbd.core.manager.AgentLinkManager;
import io.netty.channel.ChannelHandlerContext;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;



@Slf4j
@Component
@Action(value = SignalActionConstants.callSimulate,isNotice = true)
public class CallSimulateAction implements ActionAble<CallSimulateRequest> {

	@Autowired
	private AgentLinkManager agentLinkManager;

	@Override
	public DataAble invoke(ChannelHandlerContext ctx, CallSimulateRequest request) {
		log.info("receive CallSimulateRequest>>>>");
		request.setUserId(agentLinkManager.getUserId(request.getFrom()));
		request.setMainProjectId(String.valueOf(agentLinkManager.getProjectId(request.getFrom())));
		return null;
	}

	@Override
	public Class<?> getRequestClass() {
		return CallSimulateRequest.class;
	}

}